package 代码记录.校招笔试真题.笔试真题_2022.百度;

import java.util.Scanner;

/**
 * @author zx
 * @create 2022-09-13 19:37
 */
public class Test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();//总天数
        int[] arrA = new int[n];
        int[] arrB = new int[n];
        for(int i = 0;i < n;i++){
            arrA[i] = sc.nextInt();
        }
        for(int i = 0;i < n;i++){
            arrB[i] = sc.nextInt();
        }
        int res = 0;
        int x,y;
        boolean A = true;
        boolean B = true;
        for(int i = 0;i < n;i += 2){
            x = arrA[i] + arrB[i + 1];
            y = arrB[i] + arrA[i + 1];
            if(x >= y && A){
                res += x;
                if(A == false){
                    A = true;
                }
                if(B == false){
                    B = true;
                }
                B = false;
            }else if(!A){
                res += y;
                A = false;
                continue;
            }
            if(x < y && B){
                if(A == false){
                    A = true;
                }
                if(B == false){
                    B = true;
                }
                res += y;
                A = false;
            }else if(!B){
                res += x;
                B = false;
            }
        }
        if(n % 2 == 1){
            res = A == false ? res + arrB[n - 1] : res + arrA[n - 1];
        }
        System.out.println(res);
    }
}
